﻿/*
   Created 2009 December 16, Randall Maas
   Copyright (c) 2009, Randall Maas
   All rights reserved.

   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions are met:

   Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.

   Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

   Neither the name of Blackwood Designs, LLC nor the names of its contributors
   may be used to endorse or promote products derived from this software without
   specific prior written permission.

   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
   THE POSSIBILITY OF SUCH DAMAGE.
*/


using System;
using System . Collections . Generic;
using System . IO;
using System . Runtime . InteropServices;
using System . Runtime . InteropServices.ComTypes;

// Many of these are from uuids.h
public partial class DirectShowNode
{
   /// <summary>
   /// The profiles we typically use
   /// </summary>
   internal static List<IWMProfile> Profiles = new List<IWMProfile>();

   /// <summary>
   /// Gets the singleton (static class) that can load profiles
   /// </summary>
   /// <param name="ProfileManager"></param>
   /// <returns></returns>
   [DllImport("Wmvcore.dll")]
   static extern int WMCreateProfileManager([Out] out IWMProfileManager ProfileManager);


   static  DirectShowNode()
   {
      IWMProfileManager PM;
      WMCreateProfileManager(out PM);

      foreach (string S in new string[]{"DirectShow/Randy-320.prx", "DirectShow/Randy-640.prx", "DirectShow/Randy-1280.prx"})
      {
         string Data = File . ReadAllText(S);
         IWMProfile Profile;
         int Err = PM . LoadProfileByData(Data, out Profile);
         Profiles . Add(Profile);
      }
   }

   internal readonly static Guid CLSID_ShellDesktop = new Guid("00021400-0000-0000-C000-000000000046");
   internal readonly static Guid CLSID_SystemDeviceEnum = new Guid("62BE5D10-60EB-11d0-BD3B-00A0C911CE86");
   internal static Guid CLSID_VideoInputDeviceCategory = new Guid("860BB310-5D01-11d0-BD3B-00A0C911CE86");
   internal static Guid CLSID_AudioInputDeviceCategory = new Guid("33D9A762-90C8-11d0-BD43-00A0C911CE86");



//CLSID_FilterGraph (take from uuids.h DirectX include)
   internal readonly static Guid CLSID_SampleGrabber = new Guid(0xC1F400A0, 0x3F08, 0x11D3, 0x9F, 0x0B, 0x00, 0x60, 0x08, 0x03, 0x9E, 0x37);
   internal readonly static Guid CLSID_SmartTee      = new Guid("CC58E280-8AA1-11d1-B3F1-00AA003761C5");
   internal readonly static Guid CLSID_VideoRenderer = new Guid("70e102b0-5556-11ce-97c0-00aa0055595a");
   internal readonly static Guid CLSID_VideoProcAmpPropertyPage = new Guid("71F96464-78F3-11d0-A18C-00A0C9118956");
   internal readonly static Guid CLSID_CameraControlPropertyPage= new Guid("71F96465-78F3-11d0-A18C-00A0C9118956");

   // This is used to consume frames on an otherwise unbound pin
   internal readonly static Guid CLSID_NULLRenderer = new Guid(0xC1F400A4, 0x3F08, 0x11D3, 0x9F, 0x0B, 0x00, 0x60, 0x08, 0x03, 0x9E, 0x37);

   // This is used to convert between color spaces
   internal readonly static Guid CLSID_Colour       = new Guid("1643e180-90f5-11ce-97d5-00aa0055595a");

//   internal readonly static Guid CLSID_AsyncReader   = new Guid("e436ebb5-524f-11ce-9f53-0020af0ba770");
//   internal readonly static Guid CLSID_FileWriter    = new Guid("8596E5F0-0DA5-11d0-BD21-00A0C911CE86");

   internal readonly static Guid CLSID_WMODecoder = new Guid("94297043-BD82-4DFD-B0DE-8177739C6D20");
// needed for calls to RenderStream
   internal static Guid PIN_CATEGORY_CAPTURE = new Guid("fb6c4281-0353-11d1-905f-0000c0cc16ba");
   internal static Guid PIN_CATEGORY_PREVIEW = new Guid("fb6c4282-0353-11d1-905f-0000c0cc16ba");


   internal readonly static Guid MEDIATYPE_Audio = new Guid("73647561-0000-0010-8000-00AA00389B71");

   // needed for calls to RenderStream
   internal static Guid MEDIATYPE_Video = new Guid( "73646976-0000-0010-8000-00AA00389B71" );

   // Actually this is BGR
   internal readonly static Guid /*MEDIASUBTYPE*/ RGB565 = new Guid("e436eb7b-524f-11ce-9f53-0020af0ba770");
   internal readonly static Guid /*MEDIASUBTYPE*/ RGB555 = new Guid("e436eb7c-524f-11ce-9f53-0020af0ba770");
   internal readonly static Guid /*MEDIASUBTYPE*/ RGB32 = new Guid("e436eb7e-524f-11ce-9f53-0020af0ba770");
   internal readonly static Guid /*MEDIASUBTYPE*/ RGB24 = new Guid("e436eb7d-524f-11ce-9f53-0020af0ba770");
   internal readonly static Guid /*MEDIASUBTYPE*/ YUY2  = new Guid("32595559-0000-0010-8000-00AA00389B71");
   internal readonly static Guid /*MEDIASUBTYPE*/ YVYU  = new Guid("55595659-0000-0010-8000-00AA00389B71");
   internal readonly static Guid /*MEDIASUBTYPE*/ UYVY  = new Guid("59565955-0000-0010-8000-00AA00389B71");
   internal readonly static Guid /*MEDIASUBTYPE*/ IYUV  = new Guid("56555949-0000-0010-8000-00AA00389B71");
   internal readonly static Guid /*MEDIASUBTYPE*/ AYUV  = new Guid("56555941-0000-0010-8000-00AA00389B71");
   internal readonly static Guid /*MEDIASUBTYPE*/ I420  = new Guid("30323449-0000-0010-8000-00AA00389B71");

   internal Guid PROPSETID_VIDCAP_CAMERACONTROL = new Guid("C6E13370-30AC-11d0-A18C-00A0C9118956");
   internal Guid PROPSETID_VIDCAP_VIDEOPROCAMP  = new Guid("C6E13360-30AC-11d0-A18C-00A0C9118956");
}
